﻿using Language.Resource;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Localization;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;
using VisionCloud.Domain.Common;
using VisionCloud.Domain.DtoModel.Sys;
using VisionCloud.Domain.ModelAttribute;
using static VisionCloud.Core.Model.Ms.MsProject;

namespace VisionCloud.Domain.DtoModel.Ms
{
    /// <summary>
    /// 测量项枚举
    /// </summary>
    public enum EnumMeasureItem
    {
        垂直度 = 1,
        地面平整度 = 2,
        地面水平度 = 3,
        方正性 = 4,
        混凝土强度 = 5,
        截面尺寸 = 6,
        开间进深 = 7,
        楼板板底水平度 = 8,
        楼板厚度 = 9,
        门洞尺寸 = 10,
        墙面平整度 = 11,
        天花平整度 = 12,
        外窗洞口尺寸 = 13,
        外窗内侧墙体厚度极差 = 14,
        阴阳角 = 15,
        踢脚线平整度 = 16,
        门套线垂直度 = 17,
        门套线平整度 = 18,
        阴阳角直线度 = 19,
    }

    /// <summary>
    /// 查询条件对象
    /// </summary>
    public class MsProjectCondition : PageBase
    {
        /// <summary>
        /// 项目id
        /// </summary>
        public Guid ProjectId { get; set; }

        /// <summary>
        /// 楼栋
        /// </summary>
        public string Building { get; set; }

        /// <summary>
        /// 项目名称
        /// </summary>
        public string ProjectName { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        public ProjectStatus Status { get; set; }

        /// <summary>
        /// 项目标准
        /// </summary>

        public string Standard { get; set; }

        /// <summary>
        /// 项目阶段
        /// </summary>

        public string Stage { get; set; }

        /// <summary>
        /// 省份
        /// </summary>
        public string Province { get; set; }

        /// <summary>
        /// 城市
        /// </summary>
        public string City { get; set; }

        /// <summary>
        /// 区镇
        /// </summary>
        public string Town { get; set; }

        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime BeginDate { get; set; }

        /// <summary>
        /// 结束时间
        /// </summary>
        public DateTime EndDate { get; set; }

        /// <summary>
        /// 项目编号
        /// </summary>
        public string ProjectNum { get; set; }

        public string ProjectNumOrName { get; set; }

        /// <summary>
        /// 枚举值按位或
        /// </summary>
        public List<ProjectMeasureStepEnum> ProjectStepArray { set; get; }

        /// <summary>
        /// 类型(注意：若不传递该字段则默认为全部)：
        /// 自检 = 1,
        /// 巡检 = 2,
        /// </summary>
        public List<int> TaskTypeArray { get; set; }

        /// <summary>
        /// 是否白名单
        /// </summary>
        public bool Allowlist { get; set; }
    }

    public class MsProjectListCondition : MsProjectCondition
    {
        /// <summary>
        /// 排序字段 ,如果有多个用,分隔
        /// </summary>
        [OrderByField(typeof(MsProjectDto))]
        public new string OrderBy { get; set; }
    }

    /// <summary>
    /// 获取项目信息
    /// </summary>
    public class MsCondition
    {
        /// <summary>
        /// 项目Id
        /// </summary>
        public string ProjectId { get; set; }

        /// <summary>
        /// 楼栋号
        /// </summary>

        public string Build { get; set; }
        /// <summary>
        /// 楼层号
        /// </summary>

        public string Floor { get; set; }

        /// <summary>
        /// 项目名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 类型：Details
        /// </summary>
        public string Category { get; set; }

        /// <summary>
        /// 施工许可证号
        /// </summary>
        public string ConstructionPermitNum { get; set; }

        /// <summary>
        /// 类型(注意：若不传递该字段则默认为全部)：
        /// 自检 = 1,
        /// 巡检 = 2,
        /// </summary>
        public List<EnumTaskTypeName> TaskTypeArray { get; set; }

        /// <summary>
        /// 阶段(注意：若不传递该字段则默认为全部)：
        /// 结构初测 = 1,
        /// 结构复测 = 2,
        /// 结构其他 = 64,
        /// 砌筑初测 = 4,
        /// 砌筑复测 = 8,
        /// 砌筑其他 = 128,
        /// 抹灰初测 = 16,
        /// 抹灰复测 = 32,
        /// 抹灰其他 = 256
        /// </summary>
        public List<EnumTaskProperty> TaskPropertyArray { get; set; }

        /// <summary>
        /// 测量项枚举
        /// </summary>
        public List<EnumMeasureItem> MeasureItemArray { get; set; }

        private IStringLocalizer<CommonResource> CommonLocalizer { get; set; }

        public string TransferTaskTypeWhereSql()
        {
            if (TaskTypeArray == null || TaskTypeArray.Count == 0)
            {
                // 任务类型必填
                throw new ArgumentException(CommonLocalizer["YB0458"].Value);
            }

            // 任务类型：全部
            if (TaskTypeArray.Count > 2)
            {
                // 任务类型参数个数有误
                throw new ArgumentException(CommonLocalizer["YB0457"].Value);
            }

            if (TaskTypeArray.Count == 2 && TaskTypeArray.Contains(EnumTaskTypeName.自检) && TaskTypeArray.Contains(EnumTaskTypeName.巡检))
            {
                return string.Empty;
            }
            else if (TaskTypeArray.Count == 1)
            {
                return $@" AND T1.""TaskType"" = {(int)TaskTypeArray[0]}";
            }
            return string.Empty;
        }

        public string TransferTaskPropertyWhereSql()
        {
            StringBuilder whereSql = new StringBuilder();
            int cnt = 0;

            foreach (var property in TaskPropertyArray)
            {
                if (property == EnumTaskProperty.结构初测)
                {
                    whereSql.Append(@" OR (T1.""ProjectStage"" = '结构工程' AND T1.""TaskProperty"" = '初测') ");
                    cnt++;
                }
                else if (property == EnumTaskProperty.结构复测)
                {
                    whereSql.Append(@" OR (T1.""ProjectStage"" = '结构工程' AND T1.""TaskProperty"" = '复测') ");
                    cnt++;
                }
                else if (property == EnumTaskProperty.结构其他)
                {
                    whereSql.Append(@" OR (T1.""ProjectStage"" = '结构工程' AND T1.""TaskProperty"" != '初测' AND T1.""TaskProperty"" != '复测') ");
                    cnt++;
                }
                else if (property == EnumTaskProperty.砌筑初测)
                {
                    whereSql.Append(@" OR (T1.""ProjectStage"" = '砌筑工程' AND T1.""TaskProperty"" = '初测') ");
                    cnt++;
                }
                else if (property == EnumTaskProperty.砌筑复测)
                {
                    whereSql.Append(@" OR (T1.""ProjectStage"" = '砌筑工程' AND T1.""TaskProperty"" = '复测') ");
                    cnt++;
                }
                else if (property == EnumTaskProperty.砌筑其他)
                {
                    whereSql.Append(@" OR (T1.""ProjectStage"" = '砌筑工程' AND T1.""TaskProperty"" != '初测' AND T1.""TaskProperty"" != '复测') ");
                    cnt++;
                }
                else if (property == EnumTaskProperty.抹灰初测)
                {
                    whereSql.Append(@" OR (T1.""ProjectStage"" = '抹灰工程' AND T1.""TaskProperty"" = '初测') ");
                    cnt++;
                }
                else if (property == EnumTaskProperty.抹灰复测)
                {
                    whereSql.Append(@" OR (T1.""ProjectStage"" = '抹灰工程' AND T1.""TaskProperty"" = '复测') ");
                    cnt++;
                }
                else if (property == EnumTaskProperty.抹灰其他)
                {
                    whereSql.Append(@" OR (T1.""ProjectStage"" = '抹灰工程' AND T1.""TaskProperty"" != '初测' AND T1.""TaskProperty"" != '复测') ");
                    cnt++;
                }
            }

            // 阶段全选
            if (cnt == 9)
            {
                whereSql = new StringBuilder();
            }

            if (whereSql.ToString().StartsWith(" OR"))
            {
                whereSql = new StringBuilder($" AND ({whereSql.ToString().Substring(3)})");
            }
            // V4.3.1质量分析不统计装饰工程
            whereSql.Append(@" AND T1.""ProjectStage"" != '装饰工程' ");
            return whereSql.ToString();
        }

        /// <summary>
        /// 测量项筛选条件
        /// </summary>
        public Dictionary<string, string> TransferMeasureItemDict()
        {
            string whereSql = string.Empty;
            var MeasureItemDict = new Dictionary<string, string>();
            // 不过滤（注：相当于全部）
            //if (MeasureItemArray == null || MeasureItemArray.Count == 0)
            //{
            //    throw new ArgumentException("测量项必填");
            //}

            foreach (var item in MeasureItemArray)
            {
                if (item == EnumMeasureItem.垂直度)
                {
                    MeasureItemDict.Add("r-chuizhidu", EnumMeasureItem.垂直度.ToString());
                }
                else if (item == EnumMeasureItem.地面平整度)
                {
                    MeasureItemDict.Add("r-dimianpingzhengdu", EnumMeasureItem.地面平整度.ToString());
                }
                else if (item == EnumMeasureItem.地面水平度)
                {
                    MeasureItemDict.Add("r-dimianshuipingdu", EnumMeasureItem.地面水平度.ToString());
                }
                else if (item == EnumMeasureItem.方正性)
                {
                    MeasureItemDict.Add("r-fangzhengxing", EnumMeasureItem.方正性.ToString());
                }
                else if (item == EnumMeasureItem.混凝土强度)
                {
                    MeasureItemDict.Add("r-hunningtuqiangdu", EnumMeasureItem.混凝土强度.ToString());
                }
                else if (item == EnumMeasureItem.截面尺寸)
                {
                    MeasureItemDict.Add("r-jiemianchicun", EnumMeasureItem.截面尺寸.ToString());
                }
                else if (item == EnumMeasureItem.开间进深)
                {
                    MeasureItemDict.Add("r-kaijianjinshen", EnumMeasureItem.开间进深.ToString());
                }
                else if (item == EnumMeasureItem.楼板板底水平度)
                {
                    MeasureItemDict.Add("r-loubanbandishuipingdu", EnumMeasureItem.楼板板底水平度.ToString());
                }
                else if (item == EnumMeasureItem.楼板厚度)
                {
                    MeasureItemDict.Add("r-loubanhoudu", EnumMeasureItem.楼板厚度.ToString());
                }
                else if (item == EnumMeasureItem.门洞尺寸)
                {
                    MeasureItemDict.Add("r-mendongchicun", EnumMeasureItem.门洞尺寸.ToString());
                }
                else if (item == EnumMeasureItem.墙面平整度)
                {
                    MeasureItemDict.Add("r-pingzhengdu", EnumMeasureItem.墙面平整度.ToString());
                }
                else if (item == EnumMeasureItem.天花平整度)
                {
                    MeasureItemDict.Add("r-tianhuapingzhengdu", EnumMeasureItem.天花平整度.ToString());
                }
                else if (item == EnumMeasureItem.外窗洞口尺寸)
                {
                    MeasureItemDict.Add("r-waichuangdongkouchicun", EnumMeasureItem.外窗洞口尺寸.ToString());
                }
                else if (item == EnumMeasureItem.外窗内侧墙体厚度极差)
                {
                    MeasureItemDict.Add("r-waichuangneiceqiangtihoudujicha", EnumMeasureItem.外窗内侧墙体厚度极差.ToString());
                }
                else if (item == EnumMeasureItem.阴阳角)
                {
                    MeasureItemDict.Add("r-yinyang", EnumMeasureItem.阴阳角.ToString());
                }
                else if (item == EnumMeasureItem.踢脚线平整度)
                {
                    MeasureItemDict.Add("r-tijiaoxianpingzhengdu", EnumMeasureItem.踢脚线平整度.ToString());
                }
                else if (item == EnumMeasureItem.门套线垂直度)
                {
                    MeasureItemDict.Add("r-mentaoxianchuizhidu", EnumMeasureItem.门套线垂直度.ToString());
                }
                else if (item == EnumMeasureItem.门套线平整度)
                {
                    MeasureItemDict.Add("r-mentaoxianpingzhengdu", EnumMeasureItem.门套线平整度.ToString());
                }
                else if (item == EnumMeasureItem.阴阳角直线度)
                {
                    MeasureItemDict.Add("r-yinyangjiaozhixiandu", EnumMeasureItem.阴阳角直线度.ToString());
                }
            }
            return MeasureItemDict;
        }
    }

    /// <summary>
    /// 项目整体合格率分页参数
    /// </summary>
    public class ProjectOverallPassRatePara : PageBase
    {
        /// <summary>
        /// 项目Id
        /// </summary>
        public Guid ProjectId { get; set; }

        /// <summary>
        /// 项目名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 类型(注意：若不传递该字段则默认为全部)：
        /// 自检 = 1,
        /// 巡检 = 2,
        /// </summary>
        public List<EnumTaskTypeName> TaskTypeArray { get; set; }

        /// <summary>
        /// 阶段(注意：若不传递该字段则默认为全部)：
        /// </summary>
        public List<EnumTaskProperty> TaskPropertyArray { get; set; }

        public string TransferTaskTypeWhereSql()
        {
            if (TaskTypeArray == null || TaskTypeArray.Count == 0)
            {
                throw new ArgumentException("任务类型必填");
            }

            if (TaskTypeArray.Count > 2)
            {
                throw new ArgumentException("类型参数有误");
            }

            if (TaskTypeArray.Count == 2 && TaskTypeArray.Contains(EnumTaskTypeName.自检) && TaskTypeArray.Contains(EnumTaskTypeName.巡检))
            {
                return string.Empty;
            }

            // 全部=自检+巡检
            foreach (var property in TaskTypeArray)
            {
                switch (property)
                {
                    case EnumTaskTypeName.自检:
                        return @" AND T1.""TaskType"" = 1";

                    case EnumTaskTypeName.巡检:
                        return @" AND T1.""TaskType"" = 2";

                    default:
                        return string.Empty;
                }
            }
            return string.Empty;
        }

        public string TransferTaskPropertyWhereSql()
        {
            StringBuilder whereSql = new StringBuilder();
            int cnt = 0;  // 统计筛选条件

            foreach (var property in TaskPropertyArray)
            {
                if (property == EnumTaskProperty.结构初测)
                {
                    whereSql.Append(@" OR (T1.""ProjectStage"" = '结构工程' AND T1.""TaskProperty"" = '初测') ");
                    cnt++;
                }
                else if (property == EnumTaskProperty.结构复测)
                {
                    whereSql.Append(@" OR (T1.""ProjectStage"" = '结构工程' AND T1.""TaskProperty"" = '复测') ");
                    cnt++;
                }
                else if (property == EnumTaskProperty.结构其他)
                {
                    whereSql.Append(@" OR (T1.""ProjectStage"" = '结构工程' AND T1.""TaskProperty"" != '初测' AND T1.""TaskProperty"" != '复测') ");
                    cnt++;
                }
                else if (property == EnumTaskProperty.砌筑初测)
                {
                    whereSql.Append(@" OR (T1.""ProjectStage"" = '砌筑工程' AND T1.""TaskProperty"" = '初测') ");
                    cnt++;
                }
                else if (property == EnumTaskProperty.砌筑复测)
                {
                    whereSql.Append(@" OR (T1.""ProjectStage"" = '砌筑工程' AND T1.""TaskProperty"" = '复测') ");
                    cnt++;
                }
                else if (property == EnumTaskProperty.砌筑其他)
                {
                    whereSql.Append(@" OR (T1.""ProjectStage"" = '砌筑工程' AND T1.""TaskProperty"" != '初测' AND T1.""TaskProperty"" != '复测') ");
                    cnt++;
                }
                else if (property == EnumTaskProperty.抹灰初测)
                {
                    whereSql.Append(@" OR (T1.""ProjectStage"" = '抹灰工程' AND T1.""TaskProperty"" = '初测') ");
                    cnt++;
                }
                else if (property == EnumTaskProperty.抹灰复测)
                {
                    whereSql.Append(@" OR (T1.""ProjectStage"" = '抹灰工程' AND T1.""TaskProperty"" = '复测') ");
                    cnt++;
                }
                else if (property == EnumTaskProperty.抹灰其他)
                {
                    whereSql.Append(@" OR (T1.""ProjectStage"" = '抹灰工程' AND T1.""TaskProperty"" != '初测' AND T1.""TaskProperty"" != '复测') ");
                    cnt++;
                }
            }

            // 阶段全选
            if (cnt == 9)
            {
                whereSql = new StringBuilder();
            }

            if (whereSql.ToString().StartsWith(" OR"))
            {
                whereSql = new StringBuilder($" AND ({whereSql.ToString().Substring(3)})");
            }
            // V4.3.1质量分析不统计装饰工程
            whereSql.Append(@" AND T1.""ProjectStage"" != '装饰工程' ");
            return whereSql.ToString();
        }
    }

    /// <summary>
    /// 获取项目信息
    /// </summary>
    public class MsProjectPageCondition : PageBase
    {
        /// <summary>
        /// 项目Id
        /// </summary>
        public string ProjectId { get; set; }

        /// <summary>
        /// 楼栋号
        /// </summary>
        public string Build { get; set; }

        /// <summary>
        /// 楼层
        /// </summary>
        public string Floor { get; set; }

        /// <summary>
        /// 项目名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 类型：Details
        /// </summary>
        public string Category { get; set; }

        /// <summary>
        /// 施工许可证号
        /// </summary>
        public string ConstructionPermitNum { get; set; }
    }

    /// <summary>
    /// 带参上传户型图
    /// </summary>
    public class UploadHouseMapModel
    {
        /// <summary>
        /// 文件名
        /// </summary>
        [Required(ErrorMessage = "文件名称不能为空")]
        public string Name { get; set; }

        /// <summary>
        /// 项目Id
        /// </summary>
        [GuidRequired]
        public Guid ProjectId { get; set; }

        /// <summary>
        /// 户型图类型：0：非标准户型，1：标准户型
        /// </summary>
        public int MapType { get; set; }

        /// <summary>
        /// 数据类型：0（实测户型图）、1（CAD数据）、2 （FMS模式数据）
        /// </summary>
        public int DataType { get; set; } = 0;

        /// <summary>
        /// 户型图文件
        /// </summary>
        public IFormFileCollection Maps { get; set; }
    }

    /// <summary>
    /// 列表展示对象
    /// </summary>
    public class MsProjectDto
    {
        /// <summary>
        /// 项目Id
        /// </summary>
        public Guid ProjectId { get; set; }

        /// <summary>
        /// 项目名称
        /// </summary>
        [Required(ErrorMessage = "项目名称不能为空")]
        [StringLength(64, ErrorMessage = "项目名称不能超过32字")]
        public string Name { get; set; }

        /// <summary>
        /// 项目描述
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        /// 项目地图坐标
        /// </summary>
        public string MapPoint { get; set; }

        /// <summary>
        /// 项目详细地址
        /// </summary>
        [Required(ErrorMessage = "项目地址不能为空")]
        [StringLength(64, ErrorMessage = "项目地址不能超过64字")]
        public string Address { get; set; }

        /// <summary>
        /// 项目标准
        /// </summary>
        public string Standard { get; set; }

        /// <summary>
        /// 项目阶段
        /// </summary>
        public string Stage { get; set; }

        /// <summary>
        /// 项目状态
        /// </summary>
        public ProjectStatus Status { get; set; }

        /// <summary>
        /// 省份
        /// </summary>
        [Required(ErrorMessage = "省份不能为空")]
        public string Province { get; set; }

        /// <summary>
        /// 城市
        /// </summary>
        [Required(ErrorMessage = "城市不能为空")]
        public string City { get; set; }

        /// <summary>
        /// 区镇
        /// </summary>
        public string Town { get; set; }

        /// <summary>
        /// 项目楼栋信息
        /// </summary>
        public string Details { get; set; }

        /// <summary>
        /// 项目楼栋信息
        /// </summary>
        public List<Detail> DetailsInfo { get; set; }

        /// <summary>
        /// 创建者
        /// </summary>
        public Guid CreatedBy { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedDate { get; set; }

        /// <summary>
        /// 最后更新的用户
        /// </summary>
        public Guid LastUpdatedBy { get; set; }

        /// <summary>
        /// 最后更新时间
        /// </summary>
        public DateTime LastUpdatedDate { get; set; }

        /// <summary>
        /// 用户列表
        /// </summary>
        public List<UserInfo> Users { get; set; }

        public bool IsPullByClient { get; set; }

        /// <summary>
        /// 楼栋数
        /// </summary>
        public string BuildingCount { get; set; }

        /// <summary>
        /// 项目编号
        /// </summary>
        public string ProjectNo { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        public string UserNames { get; set; }

        /// <summary>
        /// 项目地址
        /// </summary>
        public string ShowAddress { get; set; }

        /// <summary>
        /// 是否可以发布
        /// </summary>
        public bool IsCanPull { get; set; }

        /// <summary>
        /// 发布时，Details中包含的条数
        /// </summary>
        public int PubliceDetailsCount { get; set; }

        /// <summary>
        /// 发布时间
        /// </summary>
        public DateTime? PubliceDate { get; set; }

        /// <summary>
        /// 是否发布过
        /// </summary>
        public bool IsPubliced
        {
            get
            {
                return PubliceDate.HasValue;
            }
        }

        /// <summary>
        /// 是否有更改的历史记录
        /// </summary>
        public bool HasChangelog { set; get; }

        //区域公司
        public string RegionalCompany { get; set; }

        // 项目经理
        public string ProjectManager { get; set; }
    }

    /// <summary>
    /// 解析json对象
    /// </summary>
    public class MsProjectFormDto
    {
        public int TaskId { get; set; }

        /// <summary>
        /// 项目名称
        /// </summary>
        public string ProjectName { get; set; }
    }

    /// <summary>
    /// 解析json对象
    /// </summary>
    public class Detail
    {
        /// <summary>
        /// 楼栋
        /// </summary>
        public string Building { get; set; }

        /// <summary>
        /// 层数
        /// </summary>
        public string Floor { get; set; }

        /// <summary>
        /// 每层户数
        /// </summary>
        public string HouseHolds { get; set; }

        /// <summary>
        /// 交付标准:毛坯/精装
        /// </summary>
        public string Standard { get; set; }

        public bool Equals(Detail d2)
        {
            if (Building == d2.Building && Floor == d2.Floor && Standard == d2.Standard)
                return true;
            return false;
        }
    }

    /// <summary>
    /// 查询条件对象
    /// </summary>
    public class MsHouseMapCondition : PageBase
    {
        /// <summary>
        /// ProjectId
        /// </summary>
        public Guid? ProjectId { get; set; }

        /// <summary>
        /// Name
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 非Guid的数据
        /// </summary>
        public Guid? ExcludeProjectId { get; set; }

        public Guid? HouseMapId { get; set; }
    }

    /// <summary>
    /// 首页项目统计
    /// </summary>
    public class ProjectForHome
    {
        /// <summary>
        /// 项目数量
        /// </summary>
        public int ProjectNum { get; set; }

        /// <summary>
        /// 设备数量
        /// </summary>
        public int RobotNum { get; set; }

        /// <summary>
        /// 城市名
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 项目Info
        /// </summary>
        public IList<ProjectInfoForHome> List { get; set; }
    }

    /// <summary>
    /// 首页项目统计
    /// </summary>
    public class ProjectInfoForHome
    {
        /// <summary>
        /// 项目Id
        /// </summary>
        public Guid ProjectId { get; set; }

        /// <summary>
        /// 项目名
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 项目城市
        /// </summary>
        public string City { get; set; }

        /// <summary>
        /// 区镇
        /// </summary>
        public string Town { get; set; }

        /// <summary>
        /// 地址
        /// </summary>
        public string Address { get; set; }

        /// <summary>
        /// 施工许可证号
        /// </summary>
        public string ConstructionPermitNum { get; set; }

        public string BuildingDetails { get; set; }
    }

    /// <summary>
    /// 质量分析整体合格率Dto
    /// </summary>

    public class ProjectOverallPassRateDto
    {
        public long Total { get; set; }

        /// <summary>
        /// 项目名称
        /// </summary>
        public string ProjectName { get; set; }

        /// <summary>
        /// 项目Id
        /// </summary>
        public Guid ProjectId { get; set; }

        ///// <summary>
        ///// 爆点数
        ///// </summary>
        //public decimal FailurePoints { get; set; }

        /// <summary>
        /// 总测量点数
        /// </summary>
        public decimal TotalPoints { get; set; }

        ///// <summary>
        ///// 不合格率
        ///// </summary>
        //public decimal FailureRate { get; set; }

        /// <summary>
        /// 合格点数
        /// </summary>
        public decimal PassPoints { get; set; }

        /// <summary>
        /// 合格百分比
        /// </summary>
        public decimal Pass { get; set; }
    }

    /// <summary>
    /// 任务dto扩展
    /// </summary>
    public class MsProjectDtoExt
    {
        /// <summary>
        /// 项目Id
        /// </summary>
        public Guid ProjectId { get; set; }

        /// <summary>
        /// 项目名称
        /// </summary>
        [Required(ErrorMessage = "项目名称不能为空")]
        [StringLength(64, ErrorMessage = "项目名称不能超过32字")]
        public string Name { get; set; }

        /// <summary>
        /// 项目描述
        /// </summary>
        public string Description { get; set; }

        ///// <summary>
        ///// 项目地图坐标
        ///// </summary>

        //public string MapPoint { get; set; }

        /// <summary>
        /// 项目地址
        /// </summary>
        [Required(ErrorMessage = "项目地址不能为空")]
        [StringLength(64, ErrorMessage = "项目地址不能超过64字")]
        public string Address { get; set; }

        /// <summary>
        /// 项目标准
        /// </summary>

        public string Standard { get; set; }
        /// <summary>
        /// 项目阶段
        /// </summary>

        public string Stage { get; set; }

        /// <summary>
        /// 项目状态
        /// </summary>
        public ProjectStatus Status { get; set; }

        /// <summary>
        /// 省份
        /// </summary>
        [Required(ErrorMessage = "省份不能为空")]
        public string Province { get; set; }

        /// <summary>
        /// 城市
        /// </summary>
        [Required(ErrorMessage = "城市不能为空")]
        public string City { get; set; }

        /// <summary>
        /// 区镇
        /// </summary>
        public string Town { get; set; }

        /// <summary>
        /// 项目楼栋信息
        /// </summary>
        public List<Detail> DetailsInfo { get; set; }

        /// <summary>
        /// 已测楼栋楼层信息
        /// </summary>
        public List<MeasuredFloors> MeasuredFloors { get; set; }

        public Guid CreatedBy { get; set; }

        public DateTime CreatedDate { get; set; }

        public Guid LastUpdatedBy { get; set; }

        public DateTime LastUpdatedDate { get; set; }
    }

    /// <summary>
    /// 已测量的楼层
    /// </summary>
    public class MeasuredFloors
    {
        /// <summary>
        /// 楼栋名称
        /// </summary>
        public string BuildingName { get; set; }

        /// <summary>
        /// 楼层名称
        /// </summary>
        public List<string> FloorsName { get; set; } = new List<string>();
    }

    public class ProjectAddressDto
    {
        /// <summary>
        /// 设备产品序号
        /// </summary>
        public string DeviceNumber { get; set; }

        public Guid DeviceGuid { get; set; }

        public Guid YunUserGuid { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 项目Id
        /// </summary>
        public Guid ProjectId { get; set; }

        /// <summary>
        /// 项目编号
        /// </summary>
        public string ProjectNo { get; set; }

        /// <summary>
        /// 项目名称
        /// </summary>
        public string ProjectName { get; set; }

        /// <summary>
        /// 省
        /// </summary>
        public string Province { get; set; }

        /// <summary>
        /// 市
        /// </summary>
        public string City { get; set; }

        /// <summary>
        /// 区
        /// </summary>
        public string Town { get; set; }

        /// <summary>
        /// 详细地址
        /// </summary>
        public string Address { get; set; }

        /// <summary>
        /// 设备列表
        /// </summary>
        public List<DeviceInfo> Devices { get; set; } = new List<DeviceInfo>();
    }

    public class DeviceInfo
    {
        /// <summary>
        /// 设备名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 设备Id
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 维度
        /// </summary>
        public string Latitude { get; set; }

        /// <summary>
        /// 经度
        /// </summary>
        public string Longitude { get; set; }
    }

    /// <summary>
    /// 列表展示对象
    /// </summary>
    public class MsProjectReportDto
    {
        /// <summary>
        /// 项目Id
        /// </summary>
        public Guid ProjectId { get; set; }

        /// <summary>
        /// 项目名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 项目编号
        /// </summary>
        public string ProjectNo { get; set; }

        /// <summary>
        /// 是否有报告：true是false否
        /// </summary>
        public bool HasReport { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedDate { get; set; }
    }

    /// <summary>
    /// 列表展示对象
    /// </summary>
    public class MeasureServiceProjectDto
    {
        /// <summary>
        /// 项目Id
        /// </summary>
        public Guid ProjectId { get; set; }

        /// <summary>
        /// 公司Id
        /// </summary>
        public Guid CompanyGuid { get; set; }

        /// <summary>
        /// 项目名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 项目编号
        /// </summary>
        public string ProjectNo { get; set; }

        /// <summary>
        /// 地址
        /// </summary>
        public string Address { get; set; }
    }

    /// <summary>
    /// 工单匹配项目Dto
    /// </summary>
    public class WorkOrderMapProject
    {
        public string ProjectId { get; set; }

        public string ProjectName { get; set; }

        public string ProjectNo { get; set; }

        public string CompyGuid { get; set; }
    }
}